package com.flying.utils.collection;

import org.apache.commons.collections4.MapUtils;

import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
import java.util.Map;

public  final class MapUtil {
    public static String asString(Map map) {
        return asString(map, null);
    }

    public static String asString(Map map, String label) {
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        PrintStream ps = new PrintStream(baos);
        MapUtils.verbosePrint(ps, label, map);
        String value = baos.toString();
        ps.close();
        return value;
    }
}